package com.xxl.job.feign;

import com.xxl.job.feign.domain.XXlJobInfoPage;
import com.xxl.job.feign.domain.XXlJobGroupPage;
import com.xxl.job.feign.domain.XxlJobStopRun;
import com.xxl.job.feign.response.ReturnT;
import com.xxl.job.xxljob.domain.XxlJobInfo;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author Tang
 * @classname XxlJobAdminRpc
 * @description [  ]
 * @date 2023/4/5 14:13
 */
public interface XxlJobAdminRpc {

    @PostMapping(value="login")
    feign.Response login(@RequestParam(name = "userName") String userName, @RequestParam(name = "password") String password);

    @PostMapping(value = "/jobgroup/pageList",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    Map<String, Object> jobGrouPageList(XXlJobGroupPage groupPage);

    @PostMapping(value = "/jobinfo/pageList",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    Map<String, Object> jobInfoPageList(XXlJobInfoPage jsonObject);

    @PostMapping(value="/jobinfo/add",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    @ResponseBody
    ReturnT<String> jobAdd(XxlJobInfo xxlJobInfo);

    @PostMapping(value = "/jobinfo/update",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    @ResponseBody
    ReturnT<String> update(XxlJobInfo jobInfo);

    @PostMapping(value = "/jobinfo/stop",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    @ResponseBody
    ReturnT<String> pause(XxlJobStopRun xxlJobStopRun);


    @PostMapping(value = "/jobinfo/start",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    @ResponseBody
    ReturnT<String> start(XxlJobStopRun xxlJobStopRun) ;

}
